package com.ruoyi.business.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.JtProductTraceabilityMapper;
import com.ruoyi.business.domain.JtProductTraceability;
import com.ruoyi.business.service.IJtProductTraceabilityService;
import com.ruoyi.common.core.text.Convert;

/**
 * 产品溯源Service业务层处理
 * 
 * @author Alan Zhang
 * @date 2025-03-29
 */
@Service
public class JtProductTraceabilityServiceImpl implements IJtProductTraceabilityService 
{
    @Autowired
    private JtProductTraceabilityMapper jtProductTraceabilityMapper;

    /**
     * 查询产品溯源
     * 
     * @param traceabilityId 产品溯源主键
     * @return 产品溯源
     */
    @Override
    public JtProductTraceability selectJtProductTraceabilityByTraceabilityId(Long traceabilityId)
    {
        return jtProductTraceabilityMapper.selectJtProductTraceabilityByTraceabilityId(traceabilityId);
    }

    /**
     * 查询产品溯源列表
     * 
     * @param jtProductTraceability 产品溯源
     * @return 产品溯源
     */
    @Override
    public List<JtProductTraceability> selectJtProductTraceabilityList(JtProductTraceability jtProductTraceability)
    {
        return jtProductTraceabilityMapper.selectJtProductTraceabilityList(jtProductTraceability);
    }

    /**
     * 新增产品溯源
     * 
     * @param jtProductTraceability 产品溯源
     * @return 结果
     */
    @Override
    public int insertJtProductTraceability(JtProductTraceability jtProductTraceability)
    {
        jtProductTraceability.setCreateTime(DateUtils.getNowDate());
        return jtProductTraceabilityMapper.insertJtProductTraceability(jtProductTraceability);
    }

    /**
     * 修改产品溯源
     * 
     * @param jtProductTraceability 产品溯源
     * @return 结果
     */
    @Override
    public int updateJtProductTraceability(JtProductTraceability jtProductTraceability)
    {
        jtProductTraceability.setUpdateTime(DateUtils.getNowDate());
        return jtProductTraceabilityMapper.updateJtProductTraceability(jtProductTraceability);
    }

    /**
     * 批量删除产品溯源
     * 
     * @param traceabilityIds 需要删除的产品溯源主键
     * @return 结果
     */
    @Override
    public int deleteJtProductTraceabilityByTraceabilityIds(String traceabilityIds)
    {
        return jtProductTraceabilityMapper.deleteJtProductTraceabilityByTraceabilityIds(Convert.toStrArray(traceabilityIds));
    }

    /**
     * 删除产品溯源信息
     * 
     * @param traceabilityId 产品溯源主键
     * @return 结果
     */
    @Override
    public int deleteJtProductTraceabilityByTraceabilityId(Long traceabilityId)
    {
        return jtProductTraceabilityMapper.deleteJtProductTraceabilityByTraceabilityId(traceabilityId);
    }
}
